package models;

import java.util.*;

import play.data.validation.Constraints.*;

import play.db.ebean.*;

import javax.persistence.*;

@Entity
public class Task extends Model {

    /**
     * 
     */
    private static final long serialVersionUID = 923719231873612L;

    public static Finder<Long, Task> find = new Finder(Long.class, Task.class);

    @Id
    public Long id;

    @Required
    public String label;

    public static List<Task> all() {
        return find.all();
    }

    public static void create(Task task) {
        task.save();
    }

    public static void delete(Long id) {
        find.ref(id).delete();
    }
    
    public static Task findById(Long id) {
    	if (id == null) return null;
        return find.ref(id);
    }

}